package com.mba.base;

import android.os.Handler;
import android.os.Message;
import android.view.Window;
import android.view.WindowManager;

/**
 * Jeffrey Shey Mail shijunfan@163.com QQ 362116120 blog http://opdar.com
 */

public abstract class BaseActivity extends RequestJsonActivity {
	protected void NOTITLE() {
		// 无title
		requestWindowFeature(Window.FEATURE_NO_TITLE);
	}
	protected Handler handler=new Handler(){
		@Override
		public void handleMessage(Message msg) {
			super.handleMessage(msg);
			switch (msg.what) {
			case 0xfff111:
				result(msg.obj);
				break;

			default:
				break;
			}
		}
	};
	protected void FULLSCREEN() {
		// 全屏
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
	}
	
	protected void result(Object o){};
	
	protected void request(RequestEntity requestEntity,RequestMethod method) {
		RequestJson requestJson=new RequestJson() {
			
			@Override
			public void result(Object object) {
				Message msg=new Message();
				msg.what=0xfff111;
				msg.obj=object;
				handler.sendMessage(msg);
			}
		};
		requestEntity.setRequestType(ActivitysType.NaN);
		request(requestJson, requestEntity, method);
	}
}
